package train48days;

import java.util.Scanner;

public class 字符串计数 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()){
            StringBuilder s1 = new StringBuilder(sc.next());
            StringBuilder s2 = new StringBuilder(sc.next());

            int len1 = sc.nextInt();
            int len2 = sc.nextInt();

            for(int i = s1.length();i < len2;i++){
                s1.append('a');
            }
            for(int i = s2.length();i < len2;i++){
                s2.append('z' + 1);
            }

            //将s1、s2对应位置上的字符相减并保存相减的结果
            int[] arr = new int[len2];
            for (int i = 0; i < arr.length; i++) {
                arr[i] = s2.charAt(i)-s1.charAt(i);
            }

            long res = 0;
            for (int i = len1; i <=len2; i++) {
                for (int j = 0; j < i; j++) {
                    res +=arr[j]*Math.pow(26,i-j-1);
                }
            }
            System.out.println((res - 1)% 1000007);
        }
    }
}
